package com.javalab.recorder.state;

import com.javalab.recorder.audio.AudioPlaybackThread;


public class PlayingState extends AbstractRecorderState {

	private static PlayingState state;

	private AudioPlaybackThread audioPlaybackThread;

	private PlayingState() {

	}

	public static PlayingState getInstance() {
		synchronized (PlayingState.class) {
			if (state == null) {
				state = new PlayingState();
			}
			return state;
		}
	}

	@Override
	public boolean isRecordButtonEnabled() {
		return false;
	}

	@Override
	public boolean isPlaybackButtonEnabled() {
		return false;
	}

	@Override
	public boolean isStopButtonEnabled() {
		return true;
	}

	@Override
	public void doRecording() {

	}

	@Override
	public void doPlaying() {

	}

	@Override
	public void doStopping() {
		audioPlaybackThread.stopPlaying();
		mainFrame.setRecorderState(StoppedState.getInstance());
	}

	public AudioPlaybackThread getAudioPlaybackThread() {
		return audioPlaybackThread;
	}

	public void setAudioPlaybackThread(AudioPlaybackThread audioPlaybackThread) {
		this.audioPlaybackThread = audioPlaybackThread;
	}

}
